<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="container3Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container3"
            v-show="store.layoutModelDetails?.container3?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #container_grid2>
                <slot name="container_grid2Container" :controller="controller" :store="store" :model="model" >
                <AppSimpleFlexContainer 
                    name="container_grid2"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #container8>
                        <slot name="container8Container" :controller="controller" :store="store" :model="model" >
                        <AppStandardContainer 
                            name="container8"
                            v-show="store.layoutModelDetails?.container8?.visible"
                            :isMultiContainer="false"
                            :layoutModelDetails="store.layoutModelDetails">
                            <template #static_label7>
                                <slot name="static_label7" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                <AppPresetText 
                                    name="static_label7"
                                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                    :layoutModelDetails="store.layoutModelDetails" />
                                </slot>
                            </template>
                        </AppStandardContainer>
                        </slot>
                    </template>
                    <template #container9>
                        <slot name="container9Container" :controller="controller" :store="store" :model="model" >
                        <AppStandardContainer 
                            name="container9"
                            v-show="store.layoutModelDetails?.container9?.visible"
                            :isMultiContainer="false"
                            :layoutModelDetails="store.layoutModelDetails">
                            <template #editor_wh>
                                <slot name="editor_wh" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                <AppPanelField
                                    name="editor_wh"
                                    :value="store.layoutData.editor_wh"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <slot name="editor_whEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                    <AppInput
                                        v-bind="{ editorType: 'TEXTBOX', }"
                                        type="text"
                                        style=""
                                        name="editor_wh"
                                        :isDebounce="true"
                                        :disabled="store.layoutModelDetails.editor_wh?.disabled ? true : false"
                                        :value="store.layoutData.editor_wh"
                                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                    />
                                    </slot>
                                </AppPanelField>
                                </slot>
                            </template>
                        </AppStandardContainer>
                        </slot>
                    </template>
                </AppSimpleFlexContainer>
                </slot>
            </template>
            <template #container6>
                <slot name="container6Container" :controller="controller" :store="store" :model="model" >
                <AppStandardContainer 
                    name="container6"
                    v-show="store.layoutModelDetails?.container6?.visible"
                    :isMultiContainer="false"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #list>
                        <slot name="list" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <AppCtrlPos name="list" :layoutModelDetails="store.layoutModelDetails">
                            <slot name="IBIZBOOKGroupByCodelistListList" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                            <IBIZBOOKGroupByCodelistListList
                                
                                :actions="{
                                    loadDraftAction: 'GetDraft',
                                    createAction: 'Create',
                                    fetchAction: 'FetchDefault',
                                    removeAction: 'Remove',
                                    updateAction: 'Update'
                                }"
                                :openView="store.openView"
                                :newView="store.newView"
                                name="list"
                                v-bind="model.ctrlParams.IBIZBOOKlist"
                                :context="store.context"
                                :viewParams="store.viewParams"
                                :closeView="store.closeView"
                                :pLoadingHelper="store.loadingHelper"
                                :pViewCtx="store.viewCtx"
                                @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                                @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                                @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"></IBIZBOOKGroupByCodelistListList>
                            </slot>
                            </AppCtrlPos>
                        </slot>
                    </template>
                </AppStandardContainer>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
        <slot name="page_containerContainer" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="page_container"
            v-show="store.layoutModelDetails?.page_container?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #static_label1>
                <slot name="static_label1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label1"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #toolbar>
                <slot name="toolbar" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="toolbar" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="ViewToolbar" :controller="controller" :store="store" :model="model" :actions="{ handleToolbarItemClick }">
                        <AppToolbar
                            name="toolbar"
                            mode="DEFAULT"
                            :items="store.toolbarItems"
                            :loading="store.loadingHelper.isLoading"
                            @item-click="(name: string, event: MouseEvent, logic: any) => { handleToolbarItemClick(controller, name, event, logic) }">
                        </AppToolbar>
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
        <slot name="container1Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container1"
            v-show="store.layoutModelDetails?.container1?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #static_label2>
                <slot name="static_label2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label2"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #searchform>
                <slot name="searchform" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="searchform" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="AVUETHREECHILDONEDefaultSearchForm" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <AVUETHREECHILDONEDefaultSearchForm
                            :actions="{
                                loadDraftAction: 'GetDraft'
                            }"
                            name="searchform"
                            v-bind="model.ctrlParams.AVUETHREECHILDONEsearchform"
                            :context="store.context"
                            :viewParams="store.viewParams"
                            :closeView="store.closeView"
                            :pLoadingHelper="store.loadingHelper"
                            :pViewCtx="store.viewCtx"
                            @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"    />
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
        <slot name="container2Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container2"
            v-show="store.layoutModelDetails?.container2?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #static_label4>
                <slot name="static_label4" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label4"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #form>
                <slot name="form" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="form" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="IBIZBOOKMainForm" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <IBIZBOOKMainForm
                            
                            :actions="{
                                loadAction: 'Get',
                                loadDraftAction: 'GetDraft',
                                updateAction: 'Update',
                                createAction: 'Create',
                                removeAction: 'Remove',
                                wfSubmitAction: 'WFSubmit',
                                wfStartAction: 'WFStart',
                            }"
                            :openView="store.openView"
                            :newView="store.newView"
                            name="form"
                            v-bind="model.ctrlParams.IBIZBOOKform"
                            :context="store.context"
                            :viewParams="store.viewParams"
                            :closeView="store.closeView"
                            :pLoadingHelper="store.loadingHelper"
                            :pViewCtx="store.viewCtx"
                            @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                            @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                            @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"    />
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
        <slot name="container4Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container4"
            v-show="store.layoutModelDetails?.container4?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #static_label6>
                <slot name="static_label6" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label6"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #grid>
                <slot name="grid" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="grid" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="AvueTestMainGrid" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                    <AvueTestMainGrid
                        
                        :actions="{
                            loadDraftAction: 'GetDraft',
                            createAction: 'Create',
                            fetchAction: 'FetchDefault',
                            removeAction: 'Remove',
                            updateAction: 'Update'
                        }"
                        :defaultEnableRowEdit="model.rowEditDefault"
                        :openView="store.openView"
                        :newView="store.newView"
                        :singleSelect="false"
                        name="grid"
                        v-bind="model.ctrlParams.AvueTestgrid"
                        :context="store.context"
                        :viewParams="store.viewParams"
                        :closeView="store.closeView"
                        :pLoadingHelper="store.loadingHelper"
                        :pViewCtx="store.viewCtx"
                        @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                        @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                        @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"></AvueTestMainGrid>
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
        <slot name="container5Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container5"
            v-show="store.layoutModelDetails?.container5?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #static_label5>
                <slot name="static_label5" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label5"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #dataview>
                <slot name="dataview" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <AppCtrlPos name="dataview" :layoutModelDetails="store.layoutModelDetails">
                    <slot name="IBIZSample0022UsrDataView" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                    <IBIZSample0022UsrDataView
                        
                        :actions="{
                            createAction: 'Create',
                            fetchAction: 'FetchDefault',
                            removeAction: 'Remove',
                            updateAction: 'Update'
                        }"
                        :openView="store.openView"
                        :newView="store.newView"
                        name="dataview"
                        v-bind="model.ctrlParams.IBIZSample0022dataview"
                        :context="store.context"
                        :viewParams="store.viewParams"
                        :closeView="store.closeView"
                        :pLoadingHelper="store.loadingHelper"
                        :pViewCtx="store.viewCtx"
                        @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                        @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                        @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"/>
                    </slot>
                    </AppCtrlPos>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
    </div>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@DECUSTOMVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import { AppToolbar } from '@components/widgets/toolbar';

import AVUETHREECHILDONEDefaultSearchForm from '@widgets/avuethreechildone/default-searchform/default-searchform.vue';
import IBIZBOOKMainForm from '@widgets/ibizbook/main-form/main-form.vue';
import AvueTestMainGrid from '@widgets/avue-test/main-grid/main-grid.vue';
import IBIZBOOKGroupByCodelistListList from '@widgets/ibizbook/group-by-codelist-list-list/group-by-codelist-list-list.vue';
import IBIZSample0022UsrDataView from '@widgets/ibiz-sample-0022/usr-data-view/usr-data-view.vue';
import { useProps, useBasic, useAction, useController } from './ibiz-order-usr-0301836445-custom-view-hook';
import { IEvent, CustomViewActionType, ICustomViewAbility, ICustomViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: CustomViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: ICustomViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: ICustomViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
